import socket

# 创建 UDP socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# 服务器地址和端口
server_address = ('localhost', 12345)

# 发送消息给服务器
message = 'Hello, Server!'
client_socket.sendto(message.encode(), server_address)

# 接收服务器的回复消息和地址信息
data, server_address = client_socket.recvfrom(1024)
print('收到服务器的回复: {}'.format(data.decode()))

# 关闭连接
client_socket.close()
